"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var http_1 = require("@angular/http");
var api_1 = require("../../../config/api");
var GroupService = /** @class */ (function () {
    function GroupService(httpService) {
        this.httpService = httpService;
    }
    // 活动管理列表
    GroupService.prototype.getActivityList = function (page, pageSize, stage, type, name, order_by, status) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/list?page=" + page + "&pageSize=" + pageSize + "&stage=" + stage + "&type=" + type + "&name=" + (name || '') + "&order_by=" + order_by + "&status=" + (status || '');
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    GroupService.prototype.getGoodsDetail = function (activity_id, activity_goods_id) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity_goods/get_goods?activity_id=" + activity_id + "&activity_goods_id=" + activity_goods_id;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    GroupService.prototype.getGroupDetail = function (activity_id, activity_goods_id) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity_report/report?activity_id=" + activity_id + "&activity_goods_id=" + activity_goods_id;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 获取一分拼团列表
    GroupService.prototype.getPennyList = function (page, pageSize, status) {
        var stage;
        if (status === '未开始') {
            stage = 1;
        }
        else if (status === '进行中') {
            stage = 2;
        }
        else {
            stage = 3;
        }
        var url = api_1.adSystemApiUrl + "/v2/member/activity/penny_list?page=" + page + "&pageSize=" + pageSize + "&stage=" + stage;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 获取店铺商品类型列表
    GroupService.prototype.getGroupList = function () {
        var url = api_1.adSystemApiUrl + "/v1/member/applet_goods_category/list";
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 获取商品列表
    GroupService.prototype.getGoodsList = function (page, pageSize, applet_goods_category_id, keyword, status) {
        var _applet_goods_category_id = applet_goods_category_id || '', _keyword = keyword || '';
        var url = api_1.adSystemApiUrl + "/v1/member/goods/list" +
            ("?applet_goods_category_id=" + _applet_goods_category_id) +
            ("&keyword=" + _keyword + "&page=" + page + "&pageSize=" + pageSize + "&status=" + status);
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 获取商品绑定了哪些分类
    GroupService.prototype.getbindListAll = function (goods_id) {
        var url = api_1.adSystemApiUrl + "/v1/member/applet_goods_category_relation/bindListAll?goods_id=" + goods_id;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 删除活动
    GroupService.prototype.delActivity = function (id) {
        var url = api_1.adSystemApiUrl + "/v2/member/activity/del";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify({ id: id });
        return this.httpService.httpPostAuth(url, body, options).map(function (rs) { return rs; });
    };
    // 修改活动状态
    GroupService.prototype.postActivityStatus = function (id, status) {
        var url = api_1.adSystemApiUrl + "/v2/member/activity/status";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify({ id: id, status: status });
        return this.httpService.httpPostAuth(url, body, options).map(function (rs) { return rs; });
    };
    // 活动详情
    GroupService.prototype.getActivityInfo = function (id) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/info?id=" + id;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 获取指定商品sku
    GroupService.prototype.getGoodsSkuList = function (id, pageSize) {
        var url = api_1.adSystemApiUrl + "/v1/member/goods_sku/list?goods_id=" + id + "&pageSize=" + pageSize;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    // 新建拼团
    GroupService.prototype.postAddGroup = function (data) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/add";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (rs) { return rs; });
    };
    //修改拼团
    GroupService.prototype.postEditGroup = function (data) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/edit";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (rs) { return rs; });
    };
    //获取中奖详情
    GroupService.prototype.getWinnerPrizeInfo = function (activityId) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity_goods_prize_winner/get_info_by_activity_id?activity_id=" + activityId;
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    //生成二维码
    GroupService.prototype.addQrcode = function (data) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/head_free_add";
        var headers = new http_1.Headers({ 'Content-Type': 'application/json' });
        var options = new http_1.RequestOptions({ headers: headers });
        var body = JSON.stringify(data);
        return this.httpService.httpPostAuth(url, body, options).map(function (rs) { return rs; });
    };
    //二维码列表
    GroupService.prototype.getQrcodeList = function (activityId) {
        var url = api_1.adSystemApiUrl + "/v3/member/activity/activity_qr_list?activity_id=" + activityId + "&pageSize=100&order_by={\"id\":\"desc\"}";
        return this.httpService.httpGetAuth(url).map(function (rs) { return rs; });
    };
    GroupService = __decorate([
        core_1.Injectable()
    ], GroupService);
    return GroupService;
}());
exports.GroupService = GroupService;
